﻿using System;
using ProjectDanmaku.Scenario;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace GameResults
{
    public class GameResultUIController : MonoBehaviour
    {
        [SerializeField] private TMP_Text titleText;
        [SerializeField] private TMP_Text aliveTimeText;
        [SerializeField] private TMP_Text hitCountText;
        
        private void Start()
        {
            titleText.text = DanmakuScenario.GameStatistics.PlayerLose ? "真过不了吗？" : "你活下来了！"; 
            aliveTimeText.text = $"存活时长: {DanmakuScenario.GameStatistics.GameTime:0.0}s";
            hitCountText.text = "剩余自机: " + DanmakuScenario.GameStatistics.PlayerJikiCount;
        }

        public void RestartGame()
        {
            SceneManager.LoadScene("Scenes/Danmaku");
        }
    }
}